<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>范例</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="pcre.constants.html">预定义常量</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="pcre.pattern.html">PCRE模式</a></div>
 <div class="up"><a href="book.pcre.html">PCRE</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="pcre.examples" class="appendix">
 <h1>范例</h1>

 <p class="para">
  <div class="example" id="example-4682">
   <p><strong>Example #1 合法模式示例</strong></p>
   <ul class="itemizedlist">
    <li class="listitem"><span class="simpara"><em>/&lt;\/\w+&gt;/</em></span></li>
    <li class="listitem"><span class="simpara"><em>|(\d{3})-\d+|Sm</em></span></li>
    <li class="listitem"><span class="simpara"><em>/^(?i)php[34]/</em></span></li>
    <li class="listitem"><span class="simpara"><em>{^\s+(\s+)?$}</em></span></li>
   </ul>
  </div>
 </p>
 <p class="para">
  <div class="example" id="example-4683">
   <p><strong>Example #2 非法模式示例</strong></p>
   <ul class="itemizedlist">
    <li class="listitem">
     <span class="simpara">
      <em>/href=&#039;(.*)&#039;</em> - 缺失结束分隔符
     </span>
    </li>
    <li class="listitem">
     <span class="simpara">
      <em>/\w+\s*\w+/J</em> - 未知模式修饰符&quot;J&quot;
     </span>
    </li>
    <li class="listitem">
     <span class="simpara">
      <em>1-\d3-\d3-\d4|</em> - 缺失开始分隔符
     </span>
    </li>
   </ul>
  </div>
 </p>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="pcre.constants.html">预定义常量</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="pcre.pattern.html">PCRE模式</a></div>
 <div class="up"><a href="book.pcre.html">PCRE</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
